Namespacing everything to /UVa.
[and.git] / UVa / 11452 - Dancing the cheeky-cheeky / 11452.cpp
blobfc7d3cf3693b336ef214f5ac3fdca2357f311f6a
1 /*
2 Accepted
3 */
4 #include <iostream>
6 using namespace std;
8 int main(){
9 int C;
10 string s;
11 cin >> C;
12 getline(cin, s);
13 while (C--){
14 getline(cin, s);
16 int n = s.size();
17 int i, j;
18 for (i=1; i<=n; ++i){
19 string first(s.substr(0, i)), second(s.substr(i, i));
20 if (first == second && first.find(s.substr(2*i)) == 0){
21 //cout << "Solution found using first " << i << " chars." << endl;
22 break;
26 j = n - 2*i;
27 for (int k=0; k<8; ++k){
28 cout << s[j];
29 j = (j+1)%(2*i);
31 cout << "..." << endl;
33 return 0;